{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 一、指定日期中位数研究"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "be02d72da7f3465b802109ce25dc3022",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/14 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "000010 美丽生态 未能成功获取数据1%....\n",
      "获取完成【国药一致】的数据，已完成0.35%....\r"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import json\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "from text import *\n",
    "import akshare as ak\n",
    "import matplotlib.dates as mdates\n",
    "import datetime\n",
    "from traceback import print_exc\n",
    "\n",
    "from matplotlib.pyplot import MultipleLocator  # 设置间隔用\n",
    "\n",
    "plt.rcParams[\"font.sans-serif\"] = ['LXGW WenKai Mono Screen',\n",
    "                                   \"SimHei\"]  # 用来正常显示中文标签\n",
    "plt.rcParams[\"axes.unicode_minus\"] = True  # 用来正常显示负号\n",
    "\n",
    "today = datetime.date.today()\n",
    "year = today.year\n",
    "if today.weekday() > 4:\n",
    "    n = 2\n",
    "else:\n",
    "    n = 1\n",
    "start = f\"{today.year-1}1231\"\n",
    "#start='20240205'\n",
    "today = f\"{today.year}{today.month:02}{today.day:02}\"\n",
    "code_name=ak.stock_info_a_code_name()\n",
    "datas={\n",
    "    'code':[],\n",
    "    'name':[],\n",
    "    'rise':[],\n",
    "}\n",
    "max_rise=-10086\n",
    "min_rise=1e9\n",
    "\n",
    "\n",
    "\n",
    "def get_data(code,name):\n",
    "    global max_rise,min_rise,max_name,min_name\n",
    "    df=ak.stock_zh_a_hist(symbol=code, period=\"daily\", start_date=start, end_date=today, adjust=\"qfq\")\n",
    "    b=list(df.收盘)[-1]\n",
    "    a=list(df.收盘)[0]\n",
    "    rise=b/a-1\n",
    "    if rise>max_rise:\n",
    "        max_name=name\n",
    "        max_rise=rise\n",
    "    if rise<min_rise:\n",
    "        min_name=name\n",
    "        min_rise=rise\n",
    "    datas['code'].append(code)\n",
    "    datas['name'].append(name)\n",
    "    datas['rise'].append(rise)\n",
    "    print(f\"获取完成【{name}】的数据，已完成{i*100/len(code_name):.2f}%...\",end=\"\\r\")\n",
    "for i in range(len(code_name)):\n",
    "#for i in range(20):\n",
    "    code=code_name.code[i]\n",
    "    name=code_name.name[i]\n",
    "    if ('退' not in name) and ('ST' not in name) and (not code.startswith(\"8\")) and ('N' not in name):\n",
    "        try:\n",
    "            get_data(code,name)\n",
    "        except:\n",
    "            print(code,name,\"未能成功获取数据\")\n",
    "            #print_exc()\n",
    "\n",
    "    \n",
    "df=pd.DataFrame(datas)\n",
    "df=df.sort_values(by=\"rise\")\n",
    "ave_rise=df['rise'].mean()\n",
    "mid_rise=df['rise'].quantile()\n",
    "\n",
    "\n",
    "\n",
    "rises = df.rise\n",
    "ratio = 0.7\n",
    "need = len(rises) * ratio\n",
    "need = int(need)\n",
    "\n",
    "c = 0\n",
    "d = 0\n",
    "for rise in rises:\n",
    "    if rise < 0:\n",
    "        c += 1\n",
    "    if rise > 0:\n",
    "        d += 1\n",
    "\n",
    "print(\" \"*100)\n",
    "print(f\"中国股市自{OKGREEN}{start}{ENDL}收盘至{OKGREEN}{today}{ENDL}共获取到{OKRED}{len(df)}{ENDL}支股票的数据，开始分析...\")\n",
    "print(\n",
    "    f\"自{OKGREEN}{start}{ENDL}收盘至{OKGREEN}{today}{ENDL}，你需要收益率达到{OKRED}{list(df.rise)[need]*100:.2f}%{ENDC}才能超越{ratio*100:.2f}%的股票！\"\n",
    ")\n",
    "print(\"#\" * 50)\n",
    "print(f\"涨幅最高的是：{OKRED}{max_name}{ENDC}，涨幅{OKRED}{max_rise*100:.2f}%{ENDC}\")\n",
    "print(f\"涨幅最低的是：{OKGREEN}{min_name}{ENDC}，涨幅{OKGREEN}{min_rise*100:.2f}%{ENDC}\")\n",
    "print(f\"如果你是红的就超过了{OKRED}{(c/len(df.rise))*100:.2f}%{ENDC}的股票！\")\n",
    "fig = sns.histplot(df[\"rise\"], bins=100, kde=True)\n",
    "# plt.gcf().set_size_inches(8, 2)#同时设置宽度和高度\n",
    "fig.get_figure().set_figwidth(7)  # 设置宽度\n",
    "fig.get_figure().set_figheight(1.8)  # 设置高度\n",
    "plt.title(f\"a股自{start}收盘至{today}涨跌幅度分布\")\n",
    "plt.show()\n",
    "print(f\"下跌{OKGREEN}{c}{ENDC}家，占比：{c/len(rises)*100:.2f}%\")\n",
    "print(f\"上涨{OKRED}{d}{ENDC}家，占比：{(d/len(rises))*100:.2f}%\")\n",
    "print(f\"平盘{OKBLUE}{len(rises)-c-d}{ENDC}家，占比：{100-((c+d)/len(rises))*100:.2f}%\")\n",
    "print(f\"中位数：{OKRED}{mid_rise*100:.2f}%{ENDL}\")\n",
    "print(f\"平均数：{OKRED}{ave_rise*100:.2f}%{ENDL}\")\n",
    "\n",
    "\n",
    "# 分成10档显示中位数统计\n",
    "display(df[[\"rise\"]].describe(percentiles=[i * 0.1 for i in range(10)]))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 二、年内涨跌幅研究"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                                                                                    \n",
      "中国股市自\u001b[1;92m20241231\u001b[0m收盘至\u001b[1;92m20250108\u001b[0m共获取到\u001b[1;31m5092\u001b[0m支股票的数据，开始分析...\n",
      "自\u001b[1;92m20241231\u001b[0m收盘至\u001b[1;92m20250108\u001b[0m，你需要收益率达到\u001b[1;31m-2.70%\u001b[0m才能超越70.00%的股票！\n",
      "##################################################\n",
      "涨幅最高的是：\u001b[1;31m星图测控\u001b[0m，涨幅\u001b[1;31m535.12%\u001b[0m\n",
      "涨幅最低的是：\u001b[1;92m朗威股份\u001b[0m，涨幅\u001b[1;92m-25.53%\u001b[0m\n",
      "如果你是红的就超过了\u001b[1;31m83.15%\u001b[0m的股票！\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmoAAADdCAYAAAALgl6bAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAARllJREFUeJzt3Xdc1fX3B/DXvRe4IEuWIDhA3AsVR5kLTczyq6V+yYbWLzUtM1Nzp+Uud/lNzVWmWblyZWpajiT3TMGJigqiyB4X7r3n98f1fvQKKBgIXF/Px+M+8n7Wfd/3/cQ997yXSkQERERERFTiqIu7AERERESUOwZqRERERCUUAzUiIiKiEoqBGhEREVEJxUCNiIiIqIRioEZERERUQjFQIyIiIiqhGKgRERERlVAM1Ige05EjR5CamlrcxaD77N+/v7iLQFZo4cKFOHjwYLG9flZWFjg3/dOLgRrRYxo8eDBefvnl4i5GqRYeHo558+ZZbJsyZQpWrlxZ4GulpaWhZcuWWL58eWEVjwpJRkbGv77G1q1bMWPGjEcet2vXLuh0un/9evc7c+YMhg0bVuDzMjMzlbLMmTMHzZo1Q0pKSoGvM3fuXISEhBT4PLIODNTI6v3xxx/YvXs3Ll26hP379+PixYsAgB07dmD48OGYPXs2Ro0ahf79++PUqVP5uua+ffvw119/4e23387X8QaDAZ9//jkqVaoEJycntGjRAseOHbM45saNG2jTpg1cXV3x2muvITk52WJ/QkIC+vTpA3d3d7i7u+PVV1/FrVu3cn29BQsW4P33389135dffolq1arlmg3MzMzEsGHD4O3tDRcXF3Ts2BFRUVHK/sTERAwcOBDly5eHs7Mz2rVrh3/++SfHddasWYMKFSrgypUrD62X7OxsfPDBBxbbfv/9d3zzzTcPPc/s2rVruHTpEgBg9uzZKFOmDKpWrYojR45g586d2Ld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CcVAjYiIiKiEYqBGREREVEIxUCMiIiIqoRioEREREZVQ/w9yv4Q6yk9KLwAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 700x180 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "下跌\u001b[1;92m4234\u001b[0m家，占比：83.15%\n",
      "上涨\u001b[1;31m772\u001b[0m家，占比：15.16%\n",
      "平盘\u001b[1;94m86\u001b[0m家，占比：1.69%\n",
      "中位数：\u001b[1;31m-4.46%\u001b[0m\n",
      "平均数：\u001b[1;31m-3.62%\u001b[0m\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>rise</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>5086.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>-3.615029</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>10.384668</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-25.530000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0%</th>\n",
       "      <td>-25.530000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10%</th>\n",
       "      <td>-9.570000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20%</th>\n",
       "      <td>-7.410000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30%</th>\n",
       "      <td>-6.230000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40%</th>\n",
       "      <td>-5.270000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>-4.455000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60%</th>\n",
       "      <td>-3.680000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70%</th>\n",
       "      <td>-2.700000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80%</th>\n",
       "      <td>-0.970000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90%</th>\n",
       "      <td>2.420000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>535.120000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              rise\n",
       "count  5086.000000\n",
       "mean     -3.615029\n",
       "std      10.384668\n",
       "min     -25.530000\n",
       "0%      -25.530000\n",
       "10%      -9.570000\n",
       "20%      -7.410000\n",
       "30%      -6.230000\n",
       "40%      -5.270000\n",
       "50%      -4.455000\n",
       "60%      -3.680000\n",
       "70%      -2.700000\n",
       "80%      -0.970000\n",
       "90%       2.420000\n",
       "max     535.120000"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import json\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "from text import *\n",
    "import akshare as ak\n",
    "import matplotlib.dates as mdates\n",
    "import datetime\n",
    "from traceback import print_exc\n",
    "\n",
    "from matplotlib.pyplot import MultipleLocator  # 设置间隔用\n",
    "\n",
    "plt.rcParams[\"font.sans-serif\"] = ['LXGW WenKai Mono Screen',\n",
    "                                   \"SimHei\"]  # 用来正常显示中文标签\n",
    "plt.rcParams[\"axes.unicode_minus\"] = True  # 用来正常显示负号\n",
    "\n",
    "today = datetime.date.today()\n",
    "year = today.year\n",
    "if today.weekday() > 4:\n",
    "    n = 2\n",
    "else:\n",
    "    n = 1\n",
    "start = f\"{today.year-1}1231\"\n",
    "#start = '20240731'\n",
    "today = f\"{today.year}{today.month:02}{today.day:02}\"\n",
    "code_name=ak.stock_info_a_code_name()\n",
    "datas={\n",
    "    'code':[],\n",
    "    'name':[],\n",
    "    'rise':[],\n",
    "}\n",
    "max_rise=-10086\n",
    "min_rise=1e9\n",
    "\n",
    "df=ak.stock_zh_a_spot_em()\n",
    "\n",
    "def get_data(i):\n",
    "    global max_rise,min_rise,max_name,min_name\n",
    "    rise=df.年初至今涨跌幅[i]\n",
    "    code=df.代码[i]\n",
    "    name=df.名称[i]\n",
    "    if rise>max_rise:\n",
    "        max_name=name\n",
    "        max_rise=rise\n",
    "    if rise<min_rise:\n",
    "        min_name=name\n",
    "        min_rise=rise\n",
    "    datas['code'].append(code)\n",
    "    datas['name'].append(name)\n",
    "    datas['rise'].append(rise)\n",
    "    print(f\"获取完成【{name}】的数据，已完成{i*100/len(code_name):.2f}%...\",end=\"\\r\")\n",
    "for i in range(len(df)):\n",
    "#for i in range(20):\n",
    "    code=df.代码[i]\n",
    "    name=df.名称[i]\n",
    "    if ('退' not in name) and ('ST' not in name) and (not code.startswith(\"8\")) and ('N' not in name):\n",
    "        try:\n",
    "            get_data(i)\n",
    "        except:\n",
    "            print(code,name,\"未能成功获取数据\")\n",
    "            #print_exc()\n",
    "\n",
    "    \n",
    "df=pd.DataFrame(datas)\n",
    "df=df.sort_values(by=\"rise\")\n",
    "ave_rise=df['rise'].mean()\n",
    "mid_rise=df['rise'].quantile()\n",
    "\n",
    "\n",
    "\n",
    "rises = df.rise\n",
    "ratio = 0.7\n",
    "need = len(rises) * ratio\n",
    "need = int(need)\n",
    "\n",
    "c = 0\n",
    "d = 0\n",
    "for rise in rises:\n",
    "    if rise < 0:\n",
    "        c += 1\n",
    "    if rise > 0:\n",
    "        d += 1\n",
    "\n",
    "print(\" \"*100)\n",
    "print(f\"中国股市自{OKGREEN}{start}{ENDL}收盘至{OKGREEN}{today}{ENDL}共获取到{OKRED}{len(df)}{ENDL}支股票的数据，开始分析...\")\n",
    "print(\n",
    "    f\"自{OKGREEN}{start}{ENDL}收盘至{OKGREEN}{today}{ENDL}，你需要收益率达到{OKRED}{list(df.rise)[need]:.2f}%{ENDC}才能超越{ratio*100:.2f}%的股票！\"\n",
    ")\n",
    "print(\"#\" * 50)\n",
    "print(f\"涨幅最高的是：{OKRED}{max_name}{ENDC}，涨幅{OKRED}{max_rise:.2f}%{ENDC}\")\n",
    "print(f\"涨幅最低的是：{OKGREEN}{min_name}{ENDC}，涨幅{OKGREEN}{min_rise:.2f}%{ENDC}\")\n",
    "print(f\"如果你是红的就超过了{OKRED}{(c/len(df.rise))*100:.2f}%{ENDC}的股票！\")\n",
    "fig = sns.histplot(df[\"rise\"], bins=100, kde=True)\n",
    "# plt.gcf().set_size_inches(8, 2)#同时设置宽度和高度\n",
    "fig.get_figure().set_figwidth(7)  # 设置宽度\n",
    "fig.get_figure().set_figheight(1.8)  # 设置高度\n",
    "plt.title(f\"a股自{start}收盘至{today}涨跌幅度分布\")\n",
    "plt.show()\n",
    "print(f\"下跌{OKGREEN}{c}{ENDC}家，占比：{c/len(rises)*100:.2f}%\")\n",
    "print(f\"上涨{OKRED}{d}{ENDC}家，占比：{(d/len(rises))*100:.2f}%\")\n",
    "print(f\"平盘{OKBLUE}{len(rises)-c-d}{ENDC}家，占比：{100-((c+d)/len(rises))*100:.2f}%\")\n",
    "print(f\"中位数：{OKRED}{mid_rise:.2f}%{ENDL}\")\n",
    "print(f\"平均数：{OKRED}{ave_rise:.2f}%{ENDL}\")\n",
    "\n",
    "\n",
    "# 分成10档显示中位数统计\n",
    "display(df[[\"rise\"]].describe(percentiles=[i * 0.1 for i in range(10)]))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 三、当日涨幅"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import json\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "from text import *\n",
    "import akshare as ak\n",
    "import matplotlib.dates as mdates\n",
    "import datetime\n",
    "from traceback import print_exc\n",
    "\n",
    "from matplotlib.pyplot import MultipleLocator  # 设置间隔用\n",
    "\n",
    "plt.rcParams[\"font.sans-serif\"] = ['LXGW WenKai Mono Screen',\n",
    "                                   \"SimHei\"]  # 用来正常显示中文标签\n",
    "plt.rcParams[\"axes.unicode_minus\"] = True  # 用来正常显示负号\n",
    "\n",
    "\n",
    "today = datetime.date.today()\n",
    "long_yesterday = datetime.datetime.now()-datetime.timedelta(days=30)\n",
    "long_yesterday=f\"{long_yesterday.year}-{long_yesterday.month}-{long_yesterday.date}\"\n",
    "if today.weekday() > 4:\n",
    "    n = 2\n",
    "else:\n",
    "    n = 1\n",
    "start = f\"{today.year-1}1231\"\n",
    "# start='2022-4-27'\n",
    "today = f\"{today.year}{today.month:02}{today.day:02}\"\n",
    "code_name=ak.stock_info_a_code_name()\n",
    "datas={\n",
    "    'code':[],\n",
    "    'name':[],\n",
    "    'rise':[],\n",
    "}\n",
    "max_rise=-10086\n",
    "min_rise=1e9\n",
    "\n",
    "\n",
    "\n",
    "def get_data(code,name):\n",
    "    global max_rise,min_rise,max_name,min_name\n",
    "    df=ak.stock_zh_a_hist(symbol=code, period=\"daily\", start_date=long_yesterday, end_date=today, adjust=\"qfq\")\n",
    "    if(len(df)>0):    \n",
    "        rise=list(df.涨跌幅)[-1]\n",
    "        if rise>max_rise:\n",
    "            max_name=name\n",
    "            max_rise=rise\n",
    "        if rise<min_rise:\n",
    "            min_name=name\n",
    "            min_rise=rise\n",
    "        datas['code'].append(code)\n",
    "        datas['name'].append(name)\n",
    "        datas['rise'].append(rise)\n",
    "        print(f\"获取完成【{name}】的数据，已完成{i*100/len(code_name):.2f}%...\",end=\"\\r\")\n",
    "for i in range(len(code_name)):\n",
    "#for i in range(40):\n",
    "    code=code_name.code[i]\n",
    "    name=code_name.name[i]\n",
    "    if ('退' not in name) and ('ST' not in name) and (not code.startswith(\"8\")) and ('N' not in name):\n",
    "        try:\n",
    "            get_data(code,name)\n",
    "        except:\n",
    "            print(code,name,\"未能成功获取数据\"+\" \"*50)\n",
    "            #print_exc()\n",
    "\n",
    "    \n",
    "df=pd.DataFrame(datas)\n",
    "df=df.sort_values(by=\"rise\")\n",
    "ave_rise=df['rise'].mean()\n",
    "mid_rise=df['rise'].quantile()\n",
    "\n",
    "rises = df.rise\n",
    "ratio = 0.7\n",
    "need = len(rises) * ratio\n",
    "need = int(need)\n",
    "\n",
    "c = 0\n",
    "d = 0\n",
    "for rise in rises:\n",
    "    if rise < 0:\n",
    "        c += 1\n",
    "    if rise > 0:\n",
    "        d += 1\n",
    "\n",
    "print(\" \"*100)\n",
    "print(f\"中国股市{today}{ENDL}日共获取到{OKRED}{len(df)}{ENDL}支股票的数据，开始分析...\")\n",
    "print(\n",
    "    f\"{OKGREEN}{today}{ENDL}日，你需要收益率达到{OKRED}{list(df.rise)[need]:.2f}%{ENDC}才能超越{ratio*100:.2f}%的股票！\"\n",
    ")\n",
    "print(\"#\" * 50)\n",
    "print(f\"涨幅最高的是：{OKRED}{max_name}{ENDC}，涨幅{OKRED}{max_rise:.2f}%{ENDC}\")\n",
    "print(f\"涨幅最低的是：{OKGREEN}{min_name}{ENDC}，涨幅{OKGREEN}{min_rise:.2f}%{ENDC}\")\n",
    "print(f\"如果你是红的就超过了{OKRED}{(c/len(df.rise))*100:.2f}%{ENDC}的股票！\")\n",
    "fig = sns.histplot(df[\"rise\"], bins=100, kde=True)\n",
    "# plt.gcf().set_size_inches(8, 2)#同时设置宽度和高度\n",
    "fig.get_figure().set_figwidth(7)  # 设置宽度\n",
    "fig.get_figure().set_figheight(1.8)  # 设置高度\n",
    "plt.title(f\"a股{today}日涨跌幅度分布\")\n",
    "plt.show()\n",
    "print(f\"下跌{OKGREEN}{c}{ENDC}家，占比：{c/len(rises)*100:.2f}%\")\n",
    "print(f\"上涨{OKRED}{d}{ENDC}家，占比：{(d/len(rises))*100:.2f}%\")\n",
    "print(f\"平盘{OKBLUE}{len(rises)-c-d}{ENDC}家，占比：{100-((c+d)/len(rises))*100:.2f}%\")\n",
    "print(f\"中位数：{OKRED}{mid_rise:.2f}%{ENDL}\")\n",
    "print(f\"平均数：{OKRED}{ave_rise:.2f}%{ENDL}\")\n",
    "\n",
    "\n",
    "# 分成10档显示中位数统计\n",
    "display(df[[\"rise\"]].describe(percentiles=[i * 0.1 for i in range(10)]))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
